<?php

namespace App\Jobs;

use App\Models\XoUser;

class SendXoRegisterEmail extends Job
{
    protected $user;
    protected $password;

    public function __construct(XoUser $user, $password)
    {
        $this->user = $user;
        $this->password = $password;
    }

    public function handle()
    {
        $user = $this->user;
        // \Log::info(var_export($user, true));
        $text = strtr(trans('email.content'), [':name' => $user->name, ':password' => $this->password]);
        app('mailer')->raw($text, function ($message) use ($user) {
            $message->subject(trans('email.subject'));
            $message->to($user->email);
        });
    }
}
